package com.netty.bytebuf;

import io.netty.buffer.CompositeByteBuf;
import io.netty.buffer.Unpooled;

import java.nio.charset.StandardCharsets;

/**
 * @author renyitong
 * @version 1.0.0
 * @createTime 2023年08月10日
 * @Description
 */
public class CompositeByteBufDemo02 {

    public static void main(String[] args) {
        CompositeByteBuf cbb = Unpooled.compositeBuffer();
        cbb.addComponent(Unpooled.wrappedBuffer("abc".getBytes(StandardCharsets.UTF_8)));
        cbb.addComponent(Unpooled.wrappedBuffer("defg".getBytes(StandardCharsets.UTF_8)));

        // 进行输出复合缓冲区中的内容
        for (int i = 0; i < cbb.capacity(); i++) {
            System.out.print((char) cbb.getByte(i) + " ");
        }
    }

}
